# -*- coding: utf-8 -*-
import time  #更新版本号
from application import  app #去配置文件的版本号
class UrlManager(object):
    def __init__(self):
        pass

    @staticmethod
    def buildUrl( path ):
        return path

    @staticmethod
    def buildStaticUrl(path):
        release_version = app.config.get( 'RELEASE_VERSION' )
        ver = "%s"%( int( time.time() ) ) if not release_version else release_version
        # path =  "/static" + path + "?ver=" + ver
        # return UrlManager.buildUrl( path )
        # ver = "%s"%(int(time.time()))     ## 2222 是js 的版本号  版本号随时间变化
        path = "/static" + path + "?ver="+ ver
        return UrlManager.buildUrl( path )
    #获取图片url地址
    @staticmethod
    def buildImageUrl( path ):
        app_config = app.config['APP']
        # 拼写图片的方法   域名加上前缀，加上k值的方式
        url = app_config['domain'] + app.config['UPLOAD']['prefix_url'] + path
        return url